# -*- coding: utf-8 -*-
"""
# --------------------------------------------------------
# @Author : Pan
# @E-mail : 
# @Date   : 2025-05-19 10:51:33
# @Brief  :
# --------------------------------------------------------
"""
from typing import Dict
from enum import IntEnum


class Status(IntEnum):
    def __new__(cls, code, msg):
        obj = int.__new__(cls, code)
        obj._value_ = code
        obj.code = code
        obj.msg = msg
        return obj

    # name = value ,msg
    success = 0, 'ok'
    exist_update = 0, '数据库ID已经存在,进行更新'
    exist = 2001, '数据库ID已经存在'
    not_files = 2002, '文件为空,请导入图片进行标注'
    not_label = 2003, '标注为空,请选择图片进行标注'


def response(data=None, status=None, code=0, msg="ok", **kwargs) -> Dict:
    code = status.code if status else code
    msg = status.msg if status else msg
    res = {"code": code, "msg": msg, "data": data}
    res.update(kwargs)
    return res



if __name__ == '__main__':
    print(response())
    print(response(status=Status.exist))
    print(response(status=Status.not_files))
    print(response(status=Status.not_label))
